package codeblock_;

/**
 * @author wly
 * @create 2022-11-29 12:02
 */
public class CodeBlock01 {
    public static void main(String[] args) {
        Movie m1 = new Movie("数据结构");
        Movie m2 = new Movie("操作系统", 456);
    }
}

class Movie{
    private String name;
    private double price;
    private String director;

    {
        System.out.println("代码块被调用！");
        System.out.println("电影屏幕打开...");
        System.out.println("广告开始...");
        System.out.println("电影正是开始...");
    }

    public Movie(String name) {
        System.out.println("public Movie(String name) 被调用...");
        this.name = name;
    }

    public Movie(String name, double price) {
        System.out.println("public Movie(String name, double price) 被调用...");
        this.name = name;
        this.price = price;
    }

    public Movie(String name, double price, String director) {
        System.out.println("public Movie(String name, double price, String director) 被调用...");
        this.name = name;
        this.price = price;
        this.director = director;
    }
}
